//
//  UIImageView+WebImage.swift
//  DarkHorseWeibo
//
//  Created by yinbo on 2018/3/21.
//  Copyright © 2018年 HaoHeHealth. All rights reserved.
//

import Foundation
import SDWebImage
extension UIImageView{
    
    func cz_setImage(urlString:String?,placeholderImage:UIImage?,isAvator:Bool=false){
        guard let urlString = urlString,let url = URL(string:urlString) else { return
            image=placeholderImage
        }
        sd_setImage(with: url, placeholderImage: placeholderImage, options: [], progress: nil) {[weak self] (image, _, _, _) in
            if isAvator {
                self?.image=image?.cz_avatarImage(size: self?.bounds.size)
            }
        }
    }
}
